﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using FlickrNet;

public partial class Default2 : System.Web.UI.Page
{
    string ApiKey = "c5827120a761f346bd171c62b0b1d437";
    string SharedSecret = "1bbb37eb7eb9fefe";


    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    protected void AuthMeButton_Click1(object sender, EventArgs e)
    {
        
        // Create Flickr instance
        Flickr flickr = new Flickr(ApiKey);

        PhotoSearchOptions searchop = new PhotoSearchOptions();
        searchop.Tags = "Taiwan";

        //searchop.Page = 1;
        Photos taiwanphotos = flickr.PhotosSearch(searchop);
        //searchop.Page = 2;
        //Photos taiwapPhotos2 = flickr.PhotosSearch(searchop);
        //searchop.Page = 3;
        //Photos taiwanphotos3 = flickr.PhotosSearch(searchop);

        PhotoCollection allphotos = taiwanphotos.PhotoCollection;
        //allphotos.AddRange(taiwapPhotos2.PhotoCollection);
        //allphotos.AddRange(taiwanphotos3.PhotoCollection);
        foreach (Photo photo in allphotos)
        {
            this.Label1.Text = this.Label1.Text + "Photos title is " + photo.Title + "<br>";
            this.Image2.ImageUrl = photo.MediumUrl;
        }
        
    }
    protected void CompleteAuthButton_Click1(object sender, EventArgs e)
    {

    }
}
